# set params
NDK_ROOT=/Users/apple/sdks/android-ndk-r7b
COCOS2DX_ROOT=/Users/apple/sdks/cocos2d-1.0.1-x-0.12.0

APP_ROOT=/Users/apple/workspaces/smartphone/first
APP_ANDROID_ROOT=$APP_ROOT/android
RESOURCE_ROOT=$APP_ROOT/Resources

# make sure assets is exist
if [ -d $APP_ANDROID_ROOT/assets ]; then
    rm -rf $APP_ANDROID_ROOT/assets
fi

mkdir $APP_ANDROID_ROOT/assets

# copy resources
for file in $RESOURCE_ROOT/*
do
    if [ -d $file ]; then
        cp -rf $file $APP_ANDROID_ROOT/assets
    fi

    if [ -f $file ]; then
        cp $file $APP_ANDROID_ROOT/assets
    fi
done

# build
$NDK_ROOT/ndk-build -C $APP_ANDROID_ROOT $*

